package com.azt.api.dto;

import com.azt.api.pojo.User;
import com.azt.pojo.BaseEntity;
import com.azt.utils.PatternUtils;
import org.apache.commons.lang3.StringUtils;

import javax.persistence.Column;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.util.Date;
import java.util.List;

/**
 *
 * Created by 张栋 on 2016/12/28 13:11
 */
@Table(name = "u_user")
public class UserExt extends User {
    String companyName;//公司名称

    String userName;//用户名

    public String getCompanyName() {
        return companyName;
    }

    public void setCompanyName(String companyName) {
        this.companyName = companyName;
    }

    public String getUserName() {
        String realName = getRealName();
        if(StringUtils.isNotBlank(realName)){
            return realName;
        }else{
            String mobile = getMobile();
            if(StringUtils.isNotBlank(mobile)){
                return mobile;
            }else if (StringUtils.isNotBlank(getEmail())){
                return getEmail();
            }else{
                return getId()+"";
            }
        }
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }
}
